package com.slz3.business.module.drawManagement.draParticipateMember.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.drawManagement.draParticipateMember.domain.DraParticipateMember;
import com.slz3.business.module.drawManagement.draParticipateMember.domain.DraParticipateMemberFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class DraParticipateMemberTransactionalServiceImpl implements DraParticipateMemberTransactionalService {

    @Override
    public DraParticipateMember modify(DraParticipateMember draParticipateMemberNew) {
        Repositorys.draParticipateMember.test();
        Repositorys.draParticipateMember.save(DraParticipateMemberFactory.initBaseFields());
        System.err.println(1 / 0);
        draParticipateMemberNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.draParticipateMember.saveAndFlush(draParticipateMemberNew);
    }

    @Override
    public List<DraParticipateMember> batchModify(List<DraParticipateMember> draParticipateMemberList) {
        return Repositorys.draParticipateMember.saveAll(draParticipateMemberList);
    }
}
